//
//  VCItemView.h
//  VideoCollage
//
//  Created by Mac on 2018/6/22.
//  Copyright © 2018年 stoneobs.qq.com. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "VCItemFrameModel.h"
#import "VCItemTools.h"
#import "VCImageView.h"
#define DefultAddImage [UIImage imageNamed:@"add"]
@class VCItemView;
@protocol VCItemViewDelegate  <NSObject>
- (void)onSlectedView:(VCItemView*)view item:(VCImageView*)item;
@end
/************每个Item View******************/
#define VCItemleftInset 15 //默认inset
#define VCItemViewDefultWith  (UIScreenWidth - 2*VCItemleftInset)  //默认宽度
#define VCItemViewDefultItemInset  (10)  //默认内部item间距
@interface VCItemView : UIView
@property(nonatomic, strong) VCItemSizeModel                      *sizeModel;/**< 比例model */
@property(nonatomic, assign) CGFloat                               maxWith   ;/**<最大宽度，这个应用中最大宽度为 0.8屏幕宽  和0.5屏幕宽 默认0.8 */
@property(nonatomic, strong) NSMutableArray<VCImageView*>         *itemImageViewArray;/**<  */
@property(nonatomic, strong) NSArray<VCItemFrameModel*>           *itemFrameArray;/**< 元素itemframe */
@property(nonatomic, assign) NSInteger                            rank;/**< 1~20 可作为图片 */
@property(nonatomic, assign) CGFloat                              itemInset;/**< 每个item之间的间隙 */
@property(nonatomic, assign) CGFloat                              cornerRadious;/**< 每个item的圆角 */
@property(nonatomic, strong) NSArray <TZAssetModel*>              *assetModles;/**< 每个item 对应的模型 */
@property(nonatomic, strong) NSString                             *musicPah;/**< 音乐背景path */
@property(nonatomic, weak) id<VCItemViewDelegate>                  delegate;/**< delegate */
@property(nonatomic, assign) BOOL                                  isAllImage;/**< 是否是全是图片，图片则生成图片 */
@property(nonatomic, strong) NSMutableArray                       *arrAvAssetArray;/**< 根据path生成的avase 集合 */

@property(nonatomic, copy) void(^allAvAssetReady)(bool isAllReady);/**< 视频是否准备好的回调 */
//rank  1-20
- (instancetype)initWithRank:(NSInteger)rank;

- (void)updateItemFrame;//根据父亲视图fram 改变 根据 itemInset 改变
- (void)hideNOResultButton;//隐藏空button;
- (void)showAllButton;//展示所有button;
- (BOOL)judgeAllPathLoad;//是否所有path加载完毕
- (CGFloat)shortDuring;//根据path生成的avaset 最短时间
- (CMTime)shortDuringCMTime;//根据path生成的avaset 最短时间shortDuringCMTime
- (BOOL)judgeAllAvAssetReady;//是否准备好了所有avaseet

- (VCImageView*)nearNoresultImageView;//最近的空 viewItem

@end
